﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Utility
{
    /// <summary>
    /// 系统的配置
    /// </summary>
    public class SysConfig
    {
        /// <summary>
        /// 工作路径
        /// </summary>
        public static string workPath;
        /// <summary>
        /// 配置文件路径
        /// </summary>
        public static string configPath;
        /// <summary>
        /// 数据文件路径
        /// </summary>
        public static string dataPath;
        /// <summary>
        /// 日志文件路径
        /// </summary>
        public static string logsPath;
        /// <summary>
        /// 临时文件存放目录
        /// </summary>
        public static string tempPath;

        /// <summary>
        /// 程序中线程运行或停止标志
        /// </summary>
        public static bool b_run = false;

        /// <summary>
        /// 多语言定义文件
        /// </summary>
        public static string m_sLanguageDefine;
        /// <summary>
        /// 多语言资源文件
        /// </summary>
        public static string m_sAppResourceDeaultFile;
        /// <summary>
        /// 多语言资源文件
        /// </summary>
        public static string m_sAppResourceFile;
        /// <summary>
        /// 多语言文本提示文件
        /// </summary>
        public static string m_sMessageFile;

        /// <summary>
        /// 初始化
        /// </summary>
        public static void Init()
        {
            try
            {
                workPath = SystemTools.GetCurrentDirectory();
                configPath = workPath + "\\Config";
                dataPath = workPath + "\\Data";
                logsPath = workPath + "\\Logs";
                tempPath = workPath + "\\Temp";

                if (!Directory.Exists(configPath))
                {
                    Directory.CreateDirectory(configPath);
                }
                if (!Directory.Exists(dataPath))
                {
                    Directory.CreateDirectory(dataPath);
                }
                if (!Directory.Exists(logsPath))
                {
                    Directory.CreateDirectory(logsPath);
                }

                if (!Directory.Exists(tempPath))
                {
                    Directory.CreateDirectory(tempPath);
                }

                m_sLanguageDefine = configPath + "\\LanguageDefine.xml";
                m_sAppResourceDeaultFile = configPath + "\\AppResource.xml";
                m_sAppResourceFile = configPath + "\\AppResource_{0}.xml";
                m_sMessageFile = configPath + "\\msg_{0}.xml";

               
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
